<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
</head>
<body>
    <div id="txt"></div>
    <script>
    var iosUrl = 'https://itunes.apple.com/cn/app/id1435025012?mt=8';  //AppStore下载地址
    var anUrl = 'http://47.104.246.225/download/app-property-signed.apk';  //android下载地址
    var defaultUrl = 'http://www.agxnh.com//';  // pc端主页
    jump(iosUrl, anUrl, defaultUrl);
    // 去下载
    function jump(iosUrl, anUrl, defaultUrl) {
        var ua = navigator.userAgent, appVer = navigator.appVersion;
        var isAndroid = ua.indexOf('Android') > -1 || ua.indexOf('Linux') > -1;
        var isIOS = !!ua.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
        // 是安卓浏览器
        if (isAndroid) {
            window.location.href = anUrl; // 跳android端下载地址
        }
        // 是iOS浏览器
        if (isIOS) {
            window.location.href = iosUrl; // 跳AppStore下载地址
        }
        // 是微信内部webView
        if (isWeixn()) {
            // window.location.href = iosUrl; // 跳AppStore下载地址
            var txtNode = document.createTextNode('请点击右上角按钮, 点击使用浏览器打开');
            document.querySelector('#txt').appendChild(txtNode);
            alert("请点击右上角按钮, 点击使用浏览器打开");
        }
        // 是PC端
        if (isPC()) {
            window.location.href = defaultUrl;  // 公司主页
        }
    }
    // 是微信浏览器
    function isWeixn(){
        var ua = navigator.userAgent.toLowerCase();
        if(ua.match(/MicroMessenger/i)=="micromessenger") {
            return true;
        } else {
            return false;
        }
    }
    function isPC() {
        var uaInfo = navigator.userAgent;
        var agents = ["Android", "iPhone",
            "SymbianOS", "Windows Phone",
            "iPad", "iPod"];
        var flag = true;
        for (var v = 0; v < agents.length; v++) {
            if (uaInfo.indexOf(agents[v]) > 0) {
                flag = false;
                break;
            }
        }
        return flag;
    }
    </script>
</body>
</html>